package Array;

import java.util.*;
import java.io.*;
public class GamesWithArray{
  /*
  题1：写一个方法，接受两个数组入参，(源[],目标[])，方法将源数组的元素---->copy---->放入目标数组中，
      copy前后的两个数组遍历列出。
  */

  /*
  题2：从指定序号元素开始copy。
    int n3=((n1<n2)?n1:n2);//取两数组长度中，较小的一个。
  */
  private void two(int[] a,int[] b,int c){
    
  }
  /*
  题3   1）用冒泡法排序10个正整数，其中这10个整数是作为main()参数录入的，如果输入不足10个参数，则给出提示
  */
  private void three(int[] a){
    if(a.length <10){
      System.out.println();
    }else{
      for(int i=0;i<a.length-1;i++){
        for(int j=0;j<a.length-1-i;j++){
          if(a[j]>a[j+1]){
          int turn = a[j];
          a[j] = a[j+1];
          a[j+1] = turn;
        }
        } 
      }
      for(int i=0;i<a.length;i++){
        System.out.println(i+"::"+a[i]);
      }
    }
  }
  /*
  题4：获得当前日期的月份，转换为中文输出。    
    某个日期
   "2008-08-08"----月份。。。。。。。。
  */
  private void four(){
    Calendar cd = Calendar.getInstance();
    int year = cd.get(Calendar.YEAR);
    int month = cd.get(Calendar.MONTH);   //月份从0开始计算，需加一
    int date = cd.get(Calendar.DAY_OF_MONTH);
    
    System.out.println(year+" "+month+" "+date);
  }
  /*
  题5----------读心术游戏---
请任意想一个正两位数，减去个位和十位的数，在下表找到差值。
请记住该差值前面的字母。
[M] 0	[R] 22	[O] 66	[K] 87	[O] 64	[O] 58	[X] 32	[I] 76	[T] 6	[M] 9	
[Z] 52	[P] 11	[D] 21	[T] 39	[T] 30	[T] 59	[D] 86	[C] 46	[M] 18	[K] 35	
[W] 37	[W] 2	[D] 14	[B] 67	[N] 70	[K] 15	[B] 3	[M] 27	[W] 55	[T] 11	
[K] 12	[P] 38	[X] 96	[Y] 94	[V] 33	[D] 37	[M] 36	[S] 24	[J] 11	[I] 87	
[V] 74	[B] 16	[D] 97	[S] 44	[O] 16	[M] 45	[C] 64	[T] 3	[S] 73	[C] 73	
[Z] 60	[L] 53	[R] 69	[G] 76	[M] 54	[Q] 67	[A] 55	[R] 61	[D] 44	[Z] 75	
[D] 65	[Z] 68	[Y] 33	[M] 63	[X] 28	[U] 8	[M] 73	[S] 70	[Q] 85	[R] 48	
[X] 71	[G] 77	[M] 72	[X] 29	[Z] 41	[L] 86	[F] 92	[R] 64	[K] 1	[D] 52	
[B] 46	[M] 81	[R] 28	[L] 20	[J] 44	[R] 86	[X] 19	[R] 42	[N] 10	[X] 100	
[M] 90	[V] 8	[C] 37	[R] 7	[Z] 30	[B] 23	[J] 20	[M] 10	[C] 30	[M] 99	
请按任意键后敲回车继续下一步！
 
该字母是：M
o(∩_∩)o.....谢谢试玩！
  */
  
  private char five(){
    System.out.println("----------读心术游戏---请任意想一个正两位数，减去个位和"+
    "十位的数，在下表找到差值。请记住该差值前面的字母。");
    Random r = new Random();
    int theNum = r.nextInt(25)+65;
    char theC = (char)theNum;
    int[] intArray = {9, 18, 27, 36, 45, 54, 63, 72, 81, 90};
    for(int i=1;i<=10;i++){
      for(int j=1;j<=10;j++){
        if(i+j!=11){
          int randomNum = r.nextInt(25)+65;
          if(randomNum%9==0){
            randomNum += 1;
          }
          char randomC = (char)randomNum;
          System.out.print("["+randomC+"]"+" "+r.nextInt(100)+" ");
        }else{
           System.out.print("["+theC+"]"+" "+intArray[i-1]+" ");
        }
      }
      System.out.println();
    }//for循环结束
    System.out.println("请按任意键后敲回车继续下一步！");
    return theC;
  }
  
  /*
  /*
  题6:
  给出任意一个整数，例如10，即可生成如下数组：{1,10,2,9,3,8,4,7,5,6}    ----[对折数组]。
                        50，                  {1,50,2,49,3,48,.....}
                        111,
  */
  private  void six(int num){
    int[] a = new int[num];
    int index = 0;
    for(int i=1;i<=num/2;i++){
      a[index] = i;
      a[index+1] = num+1-i;
      index += 2;
    }
    if(num%2==1){
      a[num-1] = (num+1)/2;
    }
    System.out.println(Arrays.toString(a));
  }
  
  
  
  public static void main(String[] a){
    GamesWithArray test = new GamesWithArray();
    
    if(a.length < 10){
      //System.out.println("整数少于十个！");
    }else{
      int[] b = new int[10];
      for(int i=0;i<10;i++){
        b[i] = Integer.parseInt(a[i]);
      }
      
    }
    char c = test.five();
    BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    try{
      String str = buff.readLine();
    }catch(IOException e){
      e.printStackTrace();
    }
    
    System.out.println("该字母是："+c+"\n"+"o(∩_∩)o.....谢谢试玩！");
  }
} 
